package com.example.springstudyvue.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springstudyvue.entity.Book;
import com.example.springstudyvue.mapper.BookMapper;
import com.example.springstudyvue.service.BookService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author linKe
 * @since 2021-11-26
 */
@Service
public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements BookService {

    @Resource
    private BookMapper bookMapper;

    @Override
    public Boolean addBook(Book book) {
        return bookMapper.insert(book) > 0;
    }

    @Override
    public Boolean updateBook(Book book) {
        return bookMapper.updateById(book) > 0;
    }

    @Override
    public boolean deleteBook(Long bookId) {
        return bookMapper.deleteById(bookId) > 0;
    }


}
